<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Auth\userC;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

// Route::get('/',function(Request $request) {
//  return response()->json(['code'=>11,'msg'=>'ok']);
// });

Route::match(['get', 'post'],'/login', [userC::class, 'login']);

Route::get('/test',function(Request $request) {
    $requestData = [
        'method' => $request->method(),
        'path' => $request->path(),
        'fullUrl' => $request->fullUrl(),
        'query' => $request->query(),
        'input' => $request->all(),
        'headers' => $request->headers->all(),
        'cookies' => $request->cookies->all(),
        'files' => $request->files->all(),
        'server' => $request->server->all()
    ];
 return response()->json(['code'=>11,'msg'=>'ok','res'=>$requestData]);
});

Route::post('/getUserList', [userC::class, 'getUserList']);


Route::any('{any}', function (Request $request) {
    return response()->json(['code'=>0,'msg'=>'1无效API请求'.$request->fullUrl()]);
})->where('any', '.*');


